<!DOCTYPE html>
<html>
		<head>
		<meta charset="UTF-8">
			<meta name="viewport" content="width=device-width, initial-scale=1.0">
	        <link rel="stylesheet" href="css/nav.css">
	        <link rel="stylesheet" href="bootstrap-3.3.5/css/bootstrap.css">
		    <title>添加学生信息</title>
			<link href="css/index.css" rel="stylesheet" type="text/css" /> 
			<script type="text/javascript" src="js/jquery.1.4.2-min.js"></script>
			<script type="text/javascript" src="js/Calculation.js"></script>
			<style>
				form{
					text-align: center;
					border: 0px;
					margin: auto;
					width: 300px;
					height: 500px;
					margin-top: 100px;
					font-family: "微软雅黑";
					font-size: 17px;
				}
		#send{margin: auto;font-size: 18px;}
			</style>
</head>
	<body>
		<form>
			输入学号:<input type="text" id="stuId" value="" /><hr>
			输入姓名:<input type="text" id="stuName" value=""/><hr>
			输入学校:<input type="text" id="stuCollege" value=""/><hr>
			输入班级:<input type="text" id="stuClass" value=""/><hr><br>
			 <p><input value="提交" type="button" id="send"/></p>
	    </form>
	    
	<script type="text/javascript">
	   $('form input[type=button]').click(function(){
            $.ajax({  
                type: 'POST',  
                url: '/students',
                data: JSON.stringify({
                    "stuId": $('form input[type=text]').val(),
				"stuName": $('form input[type=text]').val(),
				"stuCollege": $('form input[type=text]').val(),
				"stuClass": $('form input[type=text]').val()
			}),
				contentType:"application/json",
					error : function() {
			   alert('请求失败 ');
		   },
                 success:function(res) {
					 console.log(res);
                alert('添加成功 ');
                 },
             });
         });
		    
	</script>
	
		
	</body>
</html>
